VXFORM2 Aircraft Types Form3 Label1 Type Code Tms Rmn TypeCode Label2 Description Tms Rmn TypeDesc TypeSave &Save TypeCancel &Cancel TypeAdd TypeDelete &Delete TypeNext &Next TypePrev &Previous TypeBrowse &Browse TypeExit E&xit Label3 Status Tms Rmn TypeStatus Form_Click @ Form_Load= TypeReturn BROWSE_ADD TypeDataClear TypeDataLoadz BROWSE_DELETE vxDeleteRec TypeCodev TypeDesc vxfieldT TypeCode_Change TypeCode_KeyPress KeyAscii3 TypeSave_Click TypeDesc_Change vxFieldSize vxSeek vxAppendBlank( vxReplString vxWriteI vxAppendBlankEnd TypeStatus vxRecNoq Deleted BROWSE_EDIT; TypeSaveh Enabled FALSE TypeCancel TypeAddy TypeDeleteZ TypeAdd_Click TypeBrowse_Click6 VXFORM2 BrowseTypes TypeCancel_Click TypeDelete_Click TypeExit_Click VXFORM17 TypeNext_Click_ vxSkip) vxEof vxBottom FALSETypeDelete TypeNextp TypePrevV TypeBrowses TypePrev_Click vxDeleted~ vxBof vxTopy SeekKey RString vxSelectDbf AirtypesDbf vxClose vxTableReset= AircraftDbf vxUseDbf Aircraf1Ntx vxUseNtx Aircraf2Ntxx vxTableDeclare VX_GREEN* vxTableField VX_FIELD` hwndCp GetFocus SendMessageH EM_LIMITTEXT Empty) EmptyString$ Form_GotFocus3 NumRecs\ TextStatus DescSize CodeSize vxSelectNtx AirtypesNtx vxEnd vxBeg TypeCode_GotFocusG TypeDesc_GotFocus RecNumk Form_Unload Cancel TypeDesc_KeyPress BROWSE_USER wants WINAPI GlobalsZ section along+ constants BROWSE_MISC Visible CursorWait CursorArrow unloaded| because needed again vxUnlock vxFilter Form_Paint vxFormGray vxFormFrame vxCtlStyle RECESSh VX_RECESS hwind cmode| fwindow Frame1 VX_CREASE TypeStatus_Changep VX_RAISE! TyepStatus8 Enbled TypeStatus_GotFocus CurrHwnd SetFocusAPI CustReturn CustDelete_Click vxCtlLength deregister areaE ENTRIES properly registered5 controls thisR guarantees smooth multitasking operation vxWindowDereg5 OpenTypes OpenCust PackFiles TestCreate TestCopy TestDataCopy should unlocked interested% MultiUser Considerations discussion TypeChange vxLockRecord Form2Active Form_Load On form load analyze results of browse return ALWAYS select the database as the first statement in the FORM_LOAD procedure. This registers thee select area with the vxBase System Task manager. You MUST also select the database as the firstr statement in the FORM_PAINT procedure. This registers the select area with the vxBase Taskr Window manager. If you do these two things, vxBase will ensure smooth multiwindow operation in the task, and also smooth multitasking operation if you wish to run more than one Visual Basic vxBase program at the same time (or multiple instances of the same Visual Basic vxBase program.e Record addition request" if user pressed ENTER then file is positioned at current record and the record number ism returned in TypeReturn. In this case we assume he wants to edit that record. s call general proc to load controlso Edit record TypeDataClear Clear Form in preparation for add or after successful delete ensure database unlockedu TypeDataLoad Load data from current record ensure data entry enabled category catname" unlock for multiusers In a multiuser or multitasking environment, the filef should be unlocked after you have extracted the datad you are interested in. See the "MultiTasking and MultiUser Considerations" section in the manual for a full discussion.n TypeCode_KeyPress Convert type code to uppercase as it is being entered also convert enter key to tab {Tab}" TypeSave_Click Validate data when save button is pressed verify something in the field Field cannot be empty" note that if this was a real application we wouldn'td allow a change to the type code if the record was being edited unless we were prepared to cross reference all of the other files affected by a change. We alsoa wouldn't allow the onscreen edit in the browse. This is just a sample application.e verify unique key if adding Duplicate Key on Add Data passed. Put it awaya notice the brackets around the control property below which gets at the data contained thereinr category catname" Update status box Record " appended" Record " saved Update Button Status- ensure database unlockedu TypeAdd_Click clear form for addition of new record Record Addition Request" ensure data entry enabled reset the buttons TypeBrowse_Click current form is unloaded because if needed again the form_load proc must be invoked to reset the control datad so we don't close files when we unload the form TypeCancel_Click Clear form data and reset button status Operation cancelled" we must disable data entry because the user could enter a new record in the blank boxes and then press the Add button. The TypeAdd_Click routine clears the form boxes again prior tor accepting input so the user's work would be lostl and he would be mad.m TypeDelete_Click get user confirmation of delete Confirm Delete Deleted Delete failed" Delete cancelled TypeExit_Click unloading the form performs cleanup for usr TypeNext_Click skip forward one record if skip error, only allow exite Error on Skip Next. Try Reindex. test for end of filef End of File! Skipped to record TypePrev_Click skip back one recordd if skip error, only allow exitN Error on Skip Previous. Try Reindex. test for beginning of filer Beginning of File! Skipped to record TypeCode_GotFocus set up text length limiti category# TypeDesc_GotFocus set up text length limit- catname"# Form_Unload close types file and reset tablea and reenable menu items if we're NOT being unloaded by the Browse button IT IS IMPORTANT THAT YOU DEREGISTER THE WINDOW THAT THE FILE SELECT AREA WAS ATTACHED TO IN THE FORM_UNLOAD PROC. IF YOU DON'T, YOU ARE LIABLE TO RUN OUT OFT TASK-WINDOW ENTRIES (96 in all are allowed) If BrowseTypes is invoked by clicking the Browseo button on the edit form, we don't want to close the files. If we get here for any other reasona (like picking the exit button on the form orm using the System menu to close the window) then we close the files, release the table memory, and reshow the menu form so the user can pick something else. TypeDesc_KeyPress convert ENTER to tab {Tab}" Form_Paint ALWAYS select the database as the first statement in the FORM_LOAD procedure. This registers thee select area with the vxBase System Task manager. You MUST also select the database as the firstr statement in the FORM_PAINT procedure. This registers the select area with the vxBase Taskr Window manager. If you do these two things, vxBase will ensure smooth multiwindow operation in the task, and also smooth multitasking operation if you wish to run more than one Visual Basic vxBase program at the same time (or multiple instances of the same Visual Basic vxBase program.e paint three dimensional controlsr if delete request from browse, do it now because we must let enhanced controls paint before asking for delete confirmation